package com.exam.mapper;

import com.exam.entity.Admin;
import com.exam.entity.Student;
import com.exam.entity.Teacher;
import com.exam.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LoginMapper {

    @Select("select id,username, status , cost, phone,email,group_id" +
            " from user_info where username = #{username} and password = #{password}")
    public Admin adminLogin(String username, String password);

    @Select("select teacherId,teacherName,institute,sex,tel,email,cardId," +
            "type,role from teacher where teacherId = #{username} and pwd = #{password}")
    public Teacher teacherLogin(Integer username, String password);

    @Select("select studentId,studentName,grade,major,clazz,institute,tel," +
            "email,cardId,sex,role from student where studentId = #{username} and pwd = #{password}")
    public Student studentLogin(Integer username,String password);

    @Select("select id,username, status , cost, phone,email,group_id" +
            " from user_info where username = #{username} and password = #{password}")
    public User userLogin(String username, String password);

    @Select("select id,username, status , cost, phone,email,group_id" +
            " from user_info where phone = #{phone}")
    User userLoginByPhone(String phone);
}
